package metier;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;

import jdbc.Connexion;
import metier.jdbc.affectation.AffectationJdbc;
import configuration.Constante;

public class AffectEleve {
//ATTRIBUTS
private Integer idAffect;
private Integer idEleve;
private java.util.Date dateDebutAff;
private java.util.Date dateFinAff;

//CONSTRUCTEURS
public AffectEleve(Integer idAffect, Integer idEleve, Date dateDebutAff,
		Date dateFinAff) {
	this.idAffect = idAffect;
	this.idEleve = idEleve;
	this.dateDebutAff = dateDebutAff;
	this.dateFinAff = dateFinAff;
}

//GETTERS et SETTERS
public Integer getIdAffect() {
	return idAffect;
}

public void setIdAffect(Integer idAffect) {
	this.idAffect = idAffect;
}

public Integer getIdEleve() {
	return idEleve;
}

public void setIdEleve(Integer idEleve) {
	this.idEleve = idEleve;
}

public java.util.Date getDateDebutAff() {
	return dateDebutAff;
}

public void setDateDebutAff(java.util.Date dateDebutAff) {
	this.dateDebutAff = dateDebutAff;
}

public java.util.Date getDateFinAff() {
	return dateFinAff;
}

public void setDateFinAff(java.util.Date dateFinAff) {
	this.dateFinAff = dateFinAff;
}

/**
 * @return
 */
public Vector<Object> getVector(){
	Vector<Object> vector = new Vector<Object>();
	Affectation aff = AffectationJdbc.getAffectation(Connexion.getConnexion(), this.idAffect);
	if ( aff != null ){
		vector.add(aff.getLibelleAffect());
	}else{
		vector.add("");
	}
	
	SimpleDateFormat sdf = new SimpleDateFormat(Constante.FORMAT_DATE_SHORT);
	vector.add(sdf.format(this.getDateDebutAff()));
	vector.add(sdf.format(this.getDateFinAff()));
	
	return vector;
}

}
